import {BubbleListItemProps} from "vue-element-plus-x/types/components/BubbleList/types";
import {defineComponent} from "vue";
import llm_exec_chunk from "@/views/ai/agent/x6/com/llm_exec_chunk.vue";
import {FilesCard, Typewriter} from 'vue-element-plus-x'
import FileList from "@/views/ai/agent/x6/com/FileList.vue";
export type listType = BubbleListItemProps & {
  role: 'user' | 'ai',
  chunk?:Chunk[],
  atTime?:Date,
  files?:string[],
}
export interface Chunk{
  node:string,
  content?:string,
  data?:any,
  status:string|'progressing'|'start'|'completed',
}
const COMPONENT_MAP:Record<string, string|Component>={
}
export default defineComponent({
  name:'ContentRenderer',
  props:{
    chunks:Array as PropType<Chunk[]>
  },
  setup(props,{slots,expose,emit}){
    const mdChid=computed(()=>{
      return props.chunks?.filter(c=>c.node==='LLM_EXEC').map(chunk=>chunk.content).join('')
    })
    //子节点
    return ()=>h('div',{},[
      h(Typewriter,{isMarkdown:true,typing:true,content:mdChid.value||''})
    ])
  },
})
